@extends('dingcan.layouts.app')
@section('content')

<!-- Page-Title -->
<div class="row">
    <div class="col-sm-12">
        <h4 class="page-title">用户管理</h4>
        <ol class="breadcrumb">
           
            <li class="active">用户列表</li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-lg-12">
        <div class="card-box">
            <div class="row">
                <div class="col-sm-8">
                    <form role="form">
                        <div class="form-group contact-search m-b-30">
                            <input type="text" id="search" class="form-control" placeholder="Search...">
                            <button type="submit" class="btn btn-white"><i class="fa fa-search"></i></button>
                        </div> <!-- form-group -->
                    </form>
                </div>
                <div class="col-sm-2">


                    <!--  <a href="#custom-modal" class="btn btn-primary btn-md waves-effect waves-light m-b-30" data-animation="fadein" data-plugin="custommodal"                                                            data-overlaySpeed="200" data-overlayColor="#36404a"><i class="md md-add"></i>添加</a> -->
                </div>

            </div>

            @if(session('rs'))
            <div class="alert alert-{{session('rs')['status']}}">
                {{ session('rs')['msg'] }}
            </div>
            @endif

            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th style="min-width: 35px;">
                            ID

                        </th>
                        

                        <th>姓名</th>
                        <th>手机号码</th>
                        <th>密码</th>
                        <th>角色</th>
                        


                        <th style="width: 200px;">操作</th>
                    </tr>
                    </thead>

                    <tbody>

                    @foreach($list as $k=>$v)
                    <tr>
                        <td>
                            {{$k+1}}
                        </td>

                        <td>
                            {{$v->name}}
                        </td>
                      
                        <td>{{$v->mobile}}</td>

                        <td>{{$v->password}}</td>
                        <td>{{$v->rank==1?'员工':'负责人'}}</td>
                       





                        <td>

                            <a href="{{url('diancan/shop/users/'.$v->id.'/edit')}}" ><i class="md md-edit"></i>编辑</a>

                            <a href="{{url('diancan/shop/users',$v->id)}}" data-method="delete"
                               data-token="{{csrf_token()}}" data-confirm="确定删除吗?"><i class="md md-close"></i>删除</a>

                        </td>
                    </tr>
                    @endforeach


                    </tbody>
                </table>
            </div>
{{--            {{$list->links()}}--}}
        </div>

    </div> <!-- end col -->


</div>
@endsection






@section('modal')
<!-- Modal -->
<div id="custom-modal" class="modal-demo">
    <button type="button" class="close" onclick="Custombox.close();">
        <span>&times;</span><span class="sr-only">Close</span>
    </button>
    <h4 class="custom-modal-title">添加用户</h4>
    <div class="custom-modal-text text-left">
        <form class="form-horizontal" role="form" action="{{url('zadmin/users')}}" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label class="col-md-2 control-label">账号</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" name="username" value="" required="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">密码</label>
                <div class="col-md-10">
                    <input type="password" class="form-control" name="password" value="" required="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">密码确认</label>
                <div class="col-md-10">
                    <input type="password" class="form-control" name="password2" value="" required="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">手机号码</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" name="mobile" value="" required="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">E-mail</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" name="email" value="" required="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">真实姓名</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" name="truename" value="" required="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">来源</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" name="source" value="" >
                </div>
            </div>
            @if(session('dcadmin')->rank==100)
            
            <div class="form-group">
                <label class="col-md-2 control-label">角色</label>
                <div class="col-md-10">
                    <select  class="form-control" name="rank" value="" required="">
                        <option value="">请选择角色</option>
                       
                        <option value="1">员工</option>
                        <option value="100">负责人</option>
                    </select>
                </div>
            </div>
            @endif



            <div class="form-group text-center">

                <button type="submit" class="btn btn-info waves-effect waves-light">保存</button>
            </div>


            {{csrf_field()}}
        </form>
    </div>
</div>






@endsection









